package Work2;
import java.util.ArrayList;
import java.util.Scanner;

public class NumCount {
	public static void main(String[] args) {
		ArrayList<Integer> arr = creatnum();
		numcount(arr);
	}
	public static void numcount(ArrayList<Integer> arr) {
		int[] t=new int[101];
		for(int i=0;i<arr.size();i++) {
			t[arr.get(i)]++;
		}
		for(int i=1;i<=100;i++) {
			if(t[i]!=0) {
				System.out.println(i+"出现"+t[i]+"次");
			}
		}
	}
	public static ArrayList<Integer> creatnum() {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> arr = new ArrayList<Integer>();
		System.out.println("请输入1-100间的整数，以0结束输入");
		int num = 1;
		while(num!=0) {
			num = sc.nextInt();
			if (num<0 || num>100) {
				continue;
			} else if(num<=100 && num>=1) {
				arr.add(num);
			} else if(num == 0) {
				break;
			}
		}
		return arr;
	}
}
